#!/bin/sh
#
# Author ： hbaolong@vip.qq.com
#
# Function : 在英文书中寻找对应单词的例句。
#

if [ $# -ne 1 ]; then
	echo "Usage: $0 word."
	exit
fi

TMPFILE=`echo $0|awk -F/ '{print $NF}'``date|sed -e "s/ //g"`.tmp

workdir="/Users/hbaolong/workshop/gitee/3place"

cd $workdir

ce $1 |sed -e "s/####/##/g"

for files in `find .|grep wordcounter.md  |grep EN |sort`
do
	if grep -q -i -w $1 $files; then 
		bookdir=`echo $files |sed -e "s/wordcounter.*//g"`

		echo "#### "$bookdir |sed -e "s/\.\///g" |sed -e "s/\///g"

		echo ""
		source $bookdir/config

		grep -i -w $1 $bookdir/$tag*.md  | sed -e "s/\./\.\n/g" |grep $1|sed -e "s/md://g" |sed -e "s/^ //g"|head -1 

		echo ""
	fi
done
